package p2pproxy;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by BOB on 2017/8/3.
 */

public class FileTimeInfo implements Parcelable {
    ///文件的子流ID
    public String vsid;
    ///文件的开始时间码
    public double startTimeCode;
    ///文件的结束时间码
    public double endTimeCode;
    ///文件时长
    public int duration;
    ///该直播是否可时移
    public boolean hasTimeShift;
    ///该直播是否处于时移中
    public boolean inTimeShift;
    ///该文件是否是直播
    public boolean live;
    ///整个播放时间轴的最旧时间码
    public double oldestTimeCode;
    ///整个播放时间轴的最新时间码
    public double latestTimeCode;

    public static final Creator<FileTimeInfo> CREATOR=new Creator<FileTimeInfo>() {
        @Override
        public FileTimeInfo createFromParcel(Parcel source) {
            FileTimeInfo info=new FileTimeInfo();
            info.readFromParcel(source);
            return info;
        }

        @Override
        public FileTimeInfo[] newArray(int size) {
            return new FileTimeInfo[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(vsid);
        dest.writeDouble(startTimeCode);
        dest.writeDouble(endTimeCode);
        dest.writeInt(duration);
        dest.writeInt(hasTimeShift?1:0);
        dest.writeInt(inTimeShift?1:0);
        dest.writeInt(live?1:0);
        dest.writeDouble(oldestTimeCode);
        dest.writeDouble(latestTimeCode);
    }

    public void readFromParcel(Parcel src)
    {
        vsid = src.readString();
        startTimeCode = src.readDouble();
        endTimeCode = src.readDouble();
        duration = src.readInt();
        hasTimeShift = src.readInt() != 0;
        inTimeShift = src.readInt() != 0;
        live = src.readInt() != 0;
        oldestTimeCode = src.readDouble();
        latestTimeCode = src.readDouble();
    }
}
